package edu.jmu.bean.attendance;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import edu.jmu.bean.user.User;
import edu.jmu.bean.attendance.SignTag;


/**
 * 签到、签退实体类
 * @author 
 *
 */
@Entity
@Table(name = "T_MANUALSIGN", catalog ="OA")
public class ManualSign implements Serializable{
	private static final long serialVersionUID = 4834805045208932758L;
	/**签卡Id**/
	private Integer id;
	/**签卡时间**/
	private Date signTime;
	/**签卡备注**/
	private String signDesc;
	/**签卡标记(是否签到)**/
	private SignTag signTag;
	/** 用户 **/
	private User user;
	
	@Id @GeneratedValue(strategy=GenerationType.AUTO)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Temporal(TemporalType.TIMESTAMP)
	public Date getSignTime() {
		return signTime;
	}
	public void setSignTime(Date signTime) {
		this.signTime = signTime;
	}
	@Column(length=50)
	public String getSignDesc() {
		return signDesc;
	}
	public void setSignDesc(String signDesc) {
		this.signDesc = signDesc;
	}
	@Enumerated(EnumType.STRING)
	@Column(length=20)
	public SignTag getSingTag() {
		return signTag;
	}
	public void setSingTag(SignTag singTag) {
		this.signTag = singTag;
	}
	@ManyToOne(cascade=CascadeType.REFRESH)
	@JoinColumn(name="User_Id")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ManualSign other = (ManualSign) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
	
	

}
